package com.byb.server.service.util;


import com.byb.server.domain.Product;
import com.byb.server.service.dto.Product_sort;

import java.util.List;
import java.util.stream.Collectors;

public class SortByProtectScope implements SortStrategy {

    /**
     *
     * @param list
     * @param products
     * @param payment
     * @return
     */
    @Override
    public List< Product_sort> sortBy(List<Product_sort> list, List<Product> products, List<Product> data,Integer payment) {
        return SortUtil.filterProduct(list, products,data, payment).stream().sorted((a,b)->b.getEnsureScopeSocre().compareTo(a.getEnsureScopeSocre()))
            .collect(Collectors.toList());
    }
}
